package com.mzj.saas.mservice.property.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mzj.saas.mservice.auth.vo.IdCard;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;


/**
 * 房产成员信息登记表明细表
 *
 * @author hikari
 * @since 2021-05-25
 */
@Entity
@Table(name = "saas_community_house_user")
@ApiModel(description = "房产成员信息登记表明细表")
@Data
public class CommunityHouseUser implements Serializable {
	private static final long serialVersionUID = 5975822723058208327L;

	/**
	 * 是否有手机号：1是 0否
	 */
	public static final Integer MOBILE_STATUS_NO = 0;                   //否
	public static final Integer MOBILE_STATUS_YES = 1;                   //是

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	/**
	 * 房产id
	 */
	@NotNull
	@ApiModelProperty(value = "房产id",required = false)
	private String communityHouseId;

	/**
	 * 小区id
	 */
	@NotNull
	@ApiModelProperty(value = "小区id",required = false)
	private String communityId;

	/**
	 * 订单id
	 */
	private String orderId;

	/**
	 * 类型：1.承租人;2.同住人
	 */
	@NotNull
	@ApiModelProperty(value = "类型：1.承租人;2.同住人",required = false)
	private Integer type;

	/**
	 * 成员用户ID：根据手机号码匹配用户
	 */
	@ApiModelProperty(value = "成员用户ID：根据手机号码匹配用户",required = false)
	private String userId;

	/**
	 * 用户类型：1 app用户 2 企业用户
	 */
	@ApiModelProperty(value = "用户类型：1 app用户 2 企业用户",required = false)
	private Integer userType;

	/**
	 * 成员姓名
	 */
	@NotBlank
	@ApiModelProperty(value = "成员姓名",required = false)
	private String name;

	/**
	 * 成员手机
	 */
	@ApiModelProperty(value = "成员手机",required = false)
	private String mobile;

	/**
	 * 状态 1正常 2删除
	 */
	@ApiModelProperty(value = "状态 1正常 2删除",required = false)
	private Integer status;

	/**
	 * 房屋关系：1.业主；2.家人；3.租客
	 */
	@Basic
	@Column(name = "relation_tag")
	@ApiModelProperty(value = "房屋关系：1.业主；2.家人；3.租客",required = false)
	private Integer relationTag;
	/**
	 * 人脸头像
	 */
	@Basic
	@Column(name = "human_face_image", nullable = true)
	@ApiModelProperty(value = "人脸头像",required = false)
	private String humanFaceImage;

	/**
	 * 身份证号码
	 */
	@Basic
	@Column(name = "card_number", nullable = true)
	@ApiModelProperty(value = "身份证号码",required = false)
	private String cardNumber;

	/**
	 * 是否变更
	 */
	@Basic
	@Column(name = "change_label", nullable = true)
	@ApiModelProperty(value = "是否变更",required = false)
	private Integer changeLabel;

	/**
	 * 操作人
	 */
	@ApiModelProperty(value = "操作人",required = false)
	private String operatorId;

	/**
	 * 操作时间
	 */
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "操作时间",required = false)
	private Date operatorTime;
	/**
	 * 承租人库id
	 */
	@Transient
	@ApiModelProperty(value = "承租人库id",required = false)
	private Long matchId;

	/**
	 * 是否启用账单 状态：1授权 2未授权
	 */
	@Basic
	@Column(name = "account_status", nullable = true)
	@ApiModelProperty(value = "是否启用账单",required = false)
	private Integer accountStatus;

	/**
	 * 是否有手机号：1是 0否
	 */
	@Basic
	@Column(name = "mobile_status", nullable = true)
	@ApiModelProperty(value = "是否有手机号：1是 0否",required = false)
	private Integer mobileStatus;

	/**
	 * 标签 1 个人承租人  2 单位承租人
	 */
	@Transient
	private Integer label; //标签 1 个人承租人  2 单位承租人

	/**
	 * 身份证内容
	 */
	@Column(name = "id_card_content", nullable = true)
	private String idCardContent;

	/**
	 * 设置未开门消息推送提醒（0：不提醒；1：提醒）
	 */
	@Column(name = "open_push_message_type", nullable = true)
	private String openPushMessageType;

	@Transient
	private IdCard idCard;

	@Column(name = "create_time", nullable = true)
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	private Date createTime;


	public String toString() {
		return "CommunityHouseUser{serialVersionUID = " + serialVersionUID + ", id = " + id + ", communityHouseId = " + communityHouseId + ", communityId = " + communityId + ", type = " + type + ", userId = " + userId + ", userType = " + userType + ", name = " + name + ", mobile = " + mobile + ", status = " + status + ", relationTag = " + relationTag + ", humanFaceImage = " + humanFaceImage + ", cardNumber = " + cardNumber + ", changeLabel = " + changeLabel + ", operatorId = " + operatorId + ", operatorTime = " + operatorTime + ", matchId = " + matchId + ", accountStatus = " + accountStatus + "}";
	}
}
